View3D

A Mini-Application Written to Showcase

Functions ScreenX() and ScreenY()

by Tomas J. Nally

Steelweaver52@aol.com


In Our Last Episode...

In NL113, Plot3D was introduced

In Issue 113 of the Liberty BASIC Newsletter (October 2003), I provided an article called Easy Functions for Plotting 3D Objects. That article discussed two [Liberty BASIC] functions that I wrote called ScreenX() and ScreenY(). These two functions require twelve arguments, the same twelve arguments to be exact. Three of these arguments consist of the coordinates of a point in 3D space. ScreenX() and ScreenY() return the equivalent 2D screen coordinates of the same point based primarily on the location of the "camera". By connecting these points with plotted lines, these two functions allow the user to create wire-model images of 3D objects.

Along with the article, I provided a small application called Plot3D.bas (screen shot shown on right). Plot3D.bas provided numerous text boxes in which the user could input most of the required arguments for the functions ScreenX() and ScreenY(). Then, upon pressing a button the program would replot the objects based on the values input by the user.

In my view, that article and demo effectively showed how changing each argument to the functions would change the plotted output. Yet, I also felt that ScreenX() and ScreenY() held more power than the simple demo was able to reveal. That is why I wrote the mini-application which is the subject of this article: View3D.bas.

Smooth, Rapid Image Redrawing with View3D

In View3D, camera location is controlled by the mouse pointer

View3d (screenshot on right) looks similar to Plot3d, but differs in the following significant way. In View3D, the camera location is set by moving sliders around with the mouse. As the camera location moves, the image is updated continually and instantly. This provides an animated view of the objects, and gives the user the sense that she is actually moving around the objects with a camera, while watching the image change "live".

View3d is not intended to replace Plot3d. This is because Plot3d essentially demonstrates changes to 9 of the 12 arguments of ScreenX() and ScreenY(), while View3d only demonstrates changes to 4 of the 12 arguments. Yet, the animation produced by View3d makes it a more enjoyable demo by far.

ScreenX() and ScreenY() Identical in Plot3D, View3D

Of course, the core technology of both programs are the functions ScreenX() and ScreenY(). These functions are identical in both programs. So, if the user is interested in extracting ScreenX() and ScreenY() for use in her own programs, she may copy and paste the functions from either View3d or Plot3d.

The View3D Screen

Here are the components of the View3D screen:

Working The View3D Controls

One helpful point to remember when working the controls is this: controls are not activated by holding down the left button and dragging the mouse. Rather, controls are activated by left-clicking once, and releasing the left mouse button, then moving the mouse pointer. The control will move with the mouse pointer until the control is "released" by a single right click of the mouse. This applies to all three slider controls.

Below is a mini-tutorial for operating the View3d controls:

More Information

To read more about the arguments required by ScreenX() and ScreenY(), see the article titled Easy Functions for Plotting 3D Objects in Issue 113 of the Liberty BASIC newsletter. The Liberty BASIC newsletter series is available [here].

View3D Copyright and License

View3D is copyright Tomas J. Nally, September 2003. My email address is Steelweaver52@aol.com.

View3D is released as open source.


Home

View 3D

Math for LB

Using the Modem

Functions

Subroutines

Hall of Fame

API Corner

Tip Corner - RUN

Clipart Viewer

User Design Graphics

Sort by Surnames

Many Textboxes

Newsletter help

Index